import React from 'react';
import {inject, observer} from 'mobx-react';
import {getEcCom, getLabel,getAntd} from '../../../util/convert';
import ReqIntervention from '../../main/Intervention';
import * as type from "../../../constants/type";

@inject('globalStore')
@observer
export default class Main extends React.Component{
    render(){
        const { WeaDialog } = getEcCom();
        const {Button} = getAntd();
        const { globalStore,visible } = this.props;
        const { JSComplete, commonParam,btnDisabled} = globalStore;
        const { requestid, requestType, intervenorright} = commonParam;
        return (
            <WeaDialog
                visible={visible}
                loadCss={true}
                initLoadCss={true}
                title={getLabel(534679, '流程调度')}
                icon="icon-coms-workflow"
                iconBgcolor='#0079DE'
                maskClosable={false}
                onCancel={this.doCancel.bind(this)}
                style={{width:"700px", height:"400px"}}
                layout={jQuery('.wf-req')[0]}
                buttons={[
                    <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@ba8v57@dok`} type="primary" size="large" disabled={btnDisabled}
                            onClick={this.submitEvent}>{getLabel(83446, '确定')}</Button>,
                    <Button ecId={`${this && this.props && this.props.ecId || ''}_Button@rmuv9t@close`} type="ghost" size="large" disabled={btnDisabled}
                            onClick={this.doCancel}>{getLabel(31129,`取消`)}</Button>
                ]}>
                    {
                        JSComplete && <ReqIntervention ecId={`${this && this.props && this.props.ecId || ''}_ReqIntervention@xwzzmi_dev`} />
                    }
            </WeaDialog>
        )
    }
    doCancel=()=>{
        const { controlDialogVisible } = this.props.globalStore;
        controlDialogVisible(type.Intervention_dialog,false);
    }

    submitEvent=()=>{
        WfForm.rightBtn.doIntervenor();
    }
}